Skip to content

Add typed JSON output to concurrent process rendering - #8804

Merged
isaacroldan merged 5 commits into
mainfrom
codex/json-ui-routing
Oct 7, 2026
Merged

isaacroldan merged 5 commits into
mainfrom
codex/json-ui-routing

Conversation

@isaacroldan

@isaacroldan isaacroldan commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Finite concurrent processes can write terminal text to stdout in JSON mode and corrupt the command result. This is the shared prerequisite for #8801, stacked on the stderr prompt defaults in #8812.

WHAT is this pull request doing?

Send finite concurrent output as JSON diagnostic and progress events on stderr, with one diagnostic per line across pipe chunks, CRLF endings, and split UTF-8 characters. Strip ANSI codes from diagnostics and keep the existing terminal renderer for streaming callers.

Interactive prompts can share stderr with JSON events. Use --json --no-input when capturing stderr as JSONL for automation.

How to manually test your changes?

With #8801 checked out, use a disposable local app with installed dependencies:

  1. Run shopify app build --path <app> --skip-dependencies-installation --json --no-input > build.json 2> build.events.jsonl. Check that stdout contains one result and build output appears as JSON events on stderr.
  2. Repeat without --json and check that normal build output remains.

Validation

169 focused tests, CLI Kit build/type checks, lint, Knip, and code-documentation generation pass. A subprocess check confirms one JSON result on stdout and correctly framed JSON events on stderr, including split UTF-8 and final lines without a newline. CI must rerun after the rebase.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • Added a CLI Kit patch changeset.

@isaacroldan
isaacroldan requested a review from a team as a code owner October 6, 2026 16:27
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Oct 6, 2026
@isaacroldan isaacroldan mentioned this pull request Oct 6, 2026
1 of 4 tasks
@isaacroldan
isaacroldan added this pull request to stack #8805 October 6, 2026 16:32
Comment thread packages/cli-kit/src/private/node/ui.tsx Outdated
Comment thread packages/cli-kit/src/private/node/ui/components/ConcurrentOutput.tsx Outdated
Comment thread packages/cli-kit/src/private/node/ui/components/ConcurrentOutput.tsx Outdated
Comment thread packages/cli-kit/src/public/node/ui.tsx
Comment thread packages/cli-kit/src/public/node/ui.tsx
Comment thread packages/cli-kit/src/public/node/ui.prompt-json.test.ts Outdated
@isaacroldan
isaacroldan force-pushed the codex/json-ui-routing branch from 441de3f to a2b5dad Compare October 7, 2026 11:12
@isaacroldan
isaacroldan requested a review from a team as a code owner October 7, 2026 11:12
@isaacroldan
isaacroldan removed this pull request from stack #8805 October 7, 2026 11:12
@isaacroldan isaacroldan changed the title Keep JSON prompts and concurrent process output on stderr Route finite concurrent output through JSON events Oct 7, 2026
@isaacroldan
isaacroldan changed the base branch from main to codex/prompts-stderr-default October 7, 2026 11:12
@isaacroldan
isaacroldan added this pull request to stack #8813 October 7, 2026 11:13
@isaacroldan isaacroldan changed the title Route finite concurrent output through JSON events Add typed JSON output to concurrent process rendering Oct 7, 2026
@isaacroldan isaacroldan mentioned this pull request Oct 7, 2026
1 of 4 tasks
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/system.d.ts
@@ -104,9 +104,9 @@ export declare function sleep(seconds: number): Promise<void>;
  */
 export declare function terminalSupportsHyperlinks(): boolean;
 /**
- * Check if the standard input and output streams support prompting.
+ * Check if standard input and standard error are terminals that support prompting.
  *
- * @returns True if the standard input and output streams support prompting.
+ * @returns True if standard input and standard error support prompting.
  */
 export declare function terminalSupportsPrompting(): boolean;
 /**
packages/cli-kit/dist/public/node/ui.d.ts
@@ -21,6 +21,7 @@ interface UIDebugOptions {
     skipTTYCheck?: boolean;
 }
 export interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortSignal'> {
+    /** Ink options for terminal UI. Finite JSON output uses the command event channel on stderr instead. */
     renderOptions?: RenderOptions;
 }
 /**
packages/cli-kit/dist/private/node/ui/components/ConcurrentOutput.d.ts
@@ -1,4 +1,4 @@
-import { OutputProcess } from '../../../../public/node/output.js';
+import { type OutputProcess } from '../../../../public/node/output.js';
 import { AbortSignal } from '../../../../public/node/abort.js';
 import { FunctionComponent } from 'react';
 export interface ConcurrentOutputProps {
@@ -6,14 +6,21 @@ export interface ConcurrentOutputProps {
     prefixColumnSize?: number;
     abortSignal: AbortSignal;
     showTimestamps?: boolean;
+    /**
+     * Keeps terminal UI running after all processes finish. Defaults to false.
+     * In JSON mode, false uses finite progress/diagnostic events; true retains streaming terminal UI.
+     */
     keepRunningAfterProcessesResolve?: boolean;
     useAlternativeColorPalette?: boolean;
 }
 interface ConcurrentOutputContext {
     outputPrefix?: string;
+    /** Controls ANSI stripping for terminal output. JSON diagnostics are always unstyled. */
     stripAnsi?: boolean;
 }
 declare function useConcurrentOutputContext<T>(context: ConcurrentOutputContext, callback: () => T): T;
+/** Runs finite processes concurrently and routes their output through the shared diagnostic context. */
+export declare function runConcurrentProcessesForJson({ processes, abortSignal, }: Pick<ConcurrentOutputProps, 'processes' | 'abortSignal'>): Promise<void>;
 /**
  * Renders output from concurrent processes to the terminal.
  * Output will be divided in a three column layout

@isaacroldan
isaacroldan added this pull request to the merge queue Oct 7, 2026
Merged via the queue into main with commit 9d9e54a Oct 7, 2026
28 of 30 checks passed
Base automatically changed from codex/prompts-stderr-default to main October 7, 2026 16:15
@isaacroldan
isaacroldan deleted the codex/json-ui-routing branch October 7, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/cli @shopify/cli package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants